<%@ page language="java" import="java.util.*" import="com.sc.bean.GoodsBean" import="com.sc.data.GoodsData" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%-- <%!public index_jsp() { --%>
<%-- 	super(); --%>
<%-- 	System.out.println("abc"); --%>
<%-- 	} %> --%>
	<%--<%myA();
	 System.out.println(basePath);--%>
	 <%
		GoodsData gd = GoodsData.getInstance();
		
		List<GoodsBean> gs = gd.getGoods(); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
    <a href='/sc/goods.html'>逛逛商品</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='SCartPage.jsp'>看看购物车</a>
<table border='1'>
<tr><td>商品编号</td><td>商品名称</td><td>商品价格</td><td>操作</td></tr>
<%for (int i = 0; i < gs.size(); i++) {
			GoodsBean g = gs.get(i);
			%>
			<tr><td><%=g.getId()%></td><td><%=g.getName()%></td><td><%=g.getPrice() %></td><td>   <a href="AddScart.jsp?id=<%=g.getId()%>">添加购物车</a>  </td></tr>
<%} %>
</table>

  </body>
</html>
